﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Sinacor.Infra.UI.Settings;

namespace Sinacor.Infra.UI.Favorites
{
    [Serializable]
    [System.Xml.Serialization.XmlInclude(typeof(CompanyFavorite))]
    public class FavoriteCollection : KeyedCollection<string, Favorite>
    {
        protected override string GetKeyForItem(Favorite item)
        {
            if (item is CompanyFavorite)
                return ((CompanyFavorite)item).CompanyId.ToString() + item.Assembly + item.ClassName;
            else
                return item.Assembly + item.ClassName;
        }
    }
}
